package com.ourway.entity;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 飞书用户同步
 *
 * @author lwh
 * @date 2021/11/28
 */
@NoArgsConstructor
@Data
public class FeiShuUser implements Serializable {

    @JsonProperty("user")
    private UserDTO user;

    @NoArgsConstructor
    @Data
    public static class UserDTO {
        @JsonProperty("union_id")
        private String unionId;
        @JsonProperty("user_id")
        private String userId;
        @JsonProperty("open_id")
        private String openId;
        @JsonProperty("name")
        private String name;
        @JsonProperty("en_name")
        private String enName;
        @JsonProperty("email")
        private String email;
        @JsonProperty("mobile")
        private String mobile;
        @JsonProperty("mobile_visible")
        private Boolean mobileVisible;
        @JsonProperty("gender")
        private Integer gender;
        @JsonProperty("avatar")
        private AvatarDTO avatar;
        @JsonProperty("status")
        private StatusDTO status;
        @JsonProperty("department_ids")
        private List<String> departmentIds;
        @JsonProperty("leader_user_id")
        private String leaderUserId;
        @JsonProperty("city")
        private String city;
        @JsonProperty("country")
        private String country;
        @JsonProperty("work_station")
        private String workStation;
        @JsonProperty("join_time")
        private Integer joinTime;
        @JsonProperty("is_tenant_manager")
        private Boolean isTenantManager;
        @JsonProperty("employee_no")
        private String employeeNo;
        @JsonProperty("employee_type")
        private Integer employeeType;
        @JsonProperty("orders")
        private List<OrdersDTO> orders;
        @JsonProperty("custom_attrs")
        private List<CustomAttrsDTO> customAttrs;
        @JsonProperty("enterprise_email")
        private String enterpriseEmail;
        @JsonProperty("job_title")
        private String jobTitle;

        @NoArgsConstructor
        @Data
        public static class AvatarDTO {
            @JsonProperty("avatar_72")
            private String avatar72;
            @JsonProperty("avatar_240")
            private String avatar240;
            @JsonProperty("avatar_640")
            private String avatar640;
            @JsonProperty("avatar_origin")
            private String avatarOrigin;
        }

        @NoArgsConstructor
        @Data
        public static class StatusDTO {
            @JsonProperty("is_frozen")
            private Boolean isFrozen;
            @JsonProperty("is_resigned")
            private Boolean isResigned;
            @JsonProperty("is_activated")
            private Boolean isActivated;
        }

        @NoArgsConstructor
        @Data
        public static class OrdersDTO {
            @JsonProperty("department_id")
            private String departmentId;
            @JsonProperty("user_order")
            private Integer userOrder;
            @JsonProperty("department_order")
            private Integer departmentOrder;
        }

        @NoArgsConstructor
        @Data
        public static class CustomAttrsDTO {
            @JsonProperty("type")
            private String type;
            @JsonProperty("id")
            private String id;
            @JsonProperty("value")
            private ValueDTO value;

            @NoArgsConstructor
            @Data
            public static class ValueDTO {
                @JsonProperty("text")
                private String text;
                @JsonProperty("url")
                private String url;
                @JsonProperty("pc_url")
                private String pcUrl;
                @JsonProperty("option_value")
                private String optionValue;
                @JsonProperty("name")
                private String name;
                @JsonProperty("picture_url")
                private String pictureUrl;
                @JsonProperty("generic_user")
                private GenericUserDTO genericUser;

                @NoArgsConstructor
                @Data
                public static class GenericUserDTO {
                    @JsonProperty("id")
                    private String id;
                    @JsonProperty("type")
                    private Integer type;
                }
            }
        }
    }
}
